/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

import { BasicFileSnapshot } from '../core/filesystem-snapshot.js';

export interface FilesystemSnapshotDetailComparator {
  compare(previous: BasicFileSnapshot, current: BasicFileSnapshot): number;
}

export class FileSystemSnapshotNameComparator implements FilesystemSnapshotDetailComparator {
  compare(previous: BasicFileSnapshot, current: BasicFileSnapshot): number {
    return previous.name.localeCompare(current.name);
  }
}

export class FileSystemSnapshotHashValueComparator implements FilesystemSnapshotDetailComparator {
  compare(previous: BasicFileSnapshot, current: BasicFileSnapshot): number {
    return previous.hashValue.localeCompare(current.hashValue);
  }
}
